package cn.imnu.legalaid.mapper;

import cn.imnu.legalaid.dto.Appointment.AppointmentDTO;
import cn.imnu.legalaid.entity.Appointments;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;

/**
* @author 18498
* @description 针对表【appointments(预约表)】的数据库操作Mapper
* @createDate 2025-09-19 17:49:09
* @Entity cn.imnu.legalaid.entity.Appointments
*/
public interface AppointmentsMapper extends BaseMapper<Appointments> {

    /**
     * 查询带用户姓名的预约信息
     */
    Page<AppointmentDTO> selectAppointmentsWithUserInfo(
            Page<AppointmentDTO> page,
            @Param("clientId") Integer clientId,
            @Param("lawyerId") Integer lawyerId,
            @Param("status") String status,
            @Param("type") String type,
            @Param("startTime") LocalDateTime startTime,
            @Param("endTime") LocalDateTime endTime
    );

    /**
     * 检查时间冲突
     */
    Integer checkTimeConflict(
            @Param("lawyerId") Integer lawyerId,
            @Param("scheduledTime") LocalDateTime scheduledTime,
            @Param("endTime") LocalDateTime endTime,
            @Param("excludeId") Integer excludeId
    );

}




